<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../css/api.css">
    <link rel="stylesheet" href="../css/aui.css">
</head>
<style>
    .aui-list-item {
        height: 3rem !important;
    }

    .aui-list-item-title {
        color: #565656 !important;
        font-size: 0.7rem !important;
    }
</style>

<body>
    <div id="app" v-cloak class="aui-content aui-margin-b-15">
        <ul class="aui-list aui-list-in">
            <!-- <li class="aui-list-item openwin" data-win="phone_num_win" :data-id="phone">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">手机号码</div>
                    <div class="aui-list-item-right" v-if="emp" style="font-size: 0.7rem;color: #838383;">{{phone}}
                    </div>
                </div>
            </li> -->
            <!-- <li class="aui-list-item openwin" data-win="tuisong_xiaoxi_win">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">推送消息设置</div>
                </div>
            </li> -->

            <li class="aui-list-item" onclick="clean_cache()">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">清除缓存</div>
                    <div class="aui-list-item-right" style="font-size: 0.7rem;color: #838383;">{{huancun}}</div>
                </div>
            </li>
            <!-- <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-title">
                        版本号
                    </div>
                    <div class="aui-list-item-right" style="font-size: 0.7rem;color: #838383;">{{appVersion}}</div>
                </div>
            </li> -->
            <li class="aui-list-item openwin" data-win="fuwu_tiaokuan_win">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">
                        用户协议条款
                    </div>
                </div>
            </li>
            <li class="aui-list-item" onclick="yinsi()">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">
                        隐私政策
                    </div>
                </div>
            </li>
            <li class="aui-list-item openwin" data-win="about_win">
                <div class="aui-list-item-inner aui-list-item-arrow">
                    <div class="aui-list-item-title">关于</div>
                    <div class="aui-list-item-right" style="font-size: 0.7rem;color: #838383;">V{{appVersion}}</div>
                </div>
            </li>

        </ul>

    </div>
    <button onclick="exit()"
        style="width: 94.6%;height: 2.25rem;background-color:#2E8EFF;border-radius:.25rem;color: #fff;font-size: .9rem;line-height: 2.25rem;margin-left: 3.2%;position: fixed;bottom: 1.5rem;font-weight: bold;">退出登录</button>

</body>

</html>
<script src="../script/set_root.js"></script>

<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/zepto.min.js"></script>
<script type="text/javascript" src="../script/hb.js"></script>
<script type="text/javascript" src="../script/vue.js"></script>
<!-- 环信接口 -->
<script type="text/javascript" src="../script/chat/easeChat.js"></script>
<script>
    apiready = function () {
        hb_ready()
        if ($api.getStorage("emp")) {
            app.emp = true
            // alert(JSON.stringify($api.getStorage("emp")))
            // app.phone = $api.getStorage("emp").mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
            //app.phone = $api.getStorage("emp").mobile
        }
        //获取缓存大小
        api.getCacheSize(function (ret) {
            var size = ret.size;
            size = parseFloat((size / 1024) / 1024).toFixed(2)
            app.huancun = size + 'M'
        });
        // 版本号
        app.appVersion = api.appVersion

    };
    var app = new Vue({
        el: "#app",
        data: {
            emp: false,
            huancun: "0M",
            appVersion: "1.0.0",
            phone: ""
        }
    })

    function yinsi() {
        api.openWin({
            name: "yinsi_win",
            url: "yinsi_win.html"
        })
    }
    //清除缓存
    function clean_cache() {
        api.confirm({
            title: '提示',
            msg: '确认清除缓存',
            buttons: ['确定', '取消']
        }, function (ret, err) {
            var index = ret.buttonIndex;
            if (index == 1) {
                api.clearCache(function () {
                    toast('清除缓存完成');
                    app.huancun = '0M'
                });
            }
        });
    }
    //点击了退出按钮
    function exit() {

        api.actionSheet({
            title: '请选择退出登录',
            cancelTitle: '取消',
            buttons: ['退出登录']
        }, function (ret, err) {
            var index = ret.buttonIndex; //下标从1开始
            if (index == 3) {
                return
            }
            if (index == 1) {
                $api.rmStorage('emp');
                $api.rmStorage('token');
                $api.rmStorage('first_login');
                $api.rmStorage('unread_total');
                $api.rmStorage('show_unread_total');
                $api.rmStorage('conversationId');
                fnLogout() // 环信退出
                sendting('tiaoToFrame0') //是mian跳到frame0

                api.openWin({
                    name: 'login',
                    url: 'widget://html/login.html',
                    pageParam: {
                        index: 1
                    },
                    slidBackEnabled: false,
                    reload: true
                });
            }
        });



    }
</script>